<?php

namespace App\Http\Controllers\V1\Api;

use App\Http\Requests\UserRequest;
use App\Models\V1\Admins;
use App\Models\V1\Advert;
use App\Models\V1\Bank;
use App\Models\V1\BankClass;
use App\Models\V1\CommonProblem;
use App\Models\V1\Product;
use App\Models\V1\SysPermission;
use App\Models\V1\SysRole;
use App\Models\V1\UpdateLog;
use App\Models\V1\Users;
use Earnp\GoogleAuthenticator\GoogleAuthenticator;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;

class CommonProblemController extends BaseController
{

    /**
     * 常见问题列表
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function List(Request $request)
    {
       $ulid =  Product::where('label','biqi-developer-platform')->value('ulid');
        $query = CommonProblem::query();

        $pageSize = $request->input('pageSize', 100);
        $order = $request->input('order', 'desc');
        $sort = $request->input('sort', 'id');


        if ($request->filled('keyword')) {
            $query->where("title", "like", "%" . $request->input('keyword') . "%");

        }

        $query->where('state', 1);
        $query->where('product', $ulid);
        $query->orderBy($sort, $order);
        $data = $query->paginate($pageSize);

        return ajax_output(200, "成功", $data);
    }














}
